package Tuan11.Bai1_Bai2;

import java.util.Scanner;

public class Bai_1 {

	/**
	 * @param args
	 */
	public final static int INT_SO_PHAN_TU = 10;
	private int[] intMang;

	public Bai_1() {
		super();
		intMang = new int[INT_SO_PHAN_TU];
		nhapMangTuDong();
	}

	private void nhapMangTuDong() {
		for (int i = 0; i < INT_SO_PHAN_TU; i++)
			intMang[i] = (int) (Math.random() * 100);

	}

	public void nhapMang() {
		Scanner in = new Scanner(System.in);
		for (int i = 0; i < INT_SO_PHAN_TU; i++) {
			System.out.println("Nhập phần tử thứ " + (i + 1));
			intMang[i] = in.nextInt();
		}
		in.close();
	}

	private void xuatMang() {
		for (int i = 0; i < INT_SO_PHAN_TU; i++)
			System.out.print(intMang[i] + "\t");

	}

	public int sum() {
		xuatMang();
		int sum = 0;
		for (int i = 0; i < INT_SO_PHAN_TU; i++)
			sum += intMang[i];

		return sum;
	}
}
